<?php

namespace app\admin\controller;

use app\admin\service\TransferService;

class TransferController extends CommonController
{
    //提现，分页列表
    public function getTransferList()
    {
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(TransferService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->getList();
        return $this->return_result($this->returnData);
    }

    //提现的详细信息
    public function getTransferDetail()
    {
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(TransferService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->getDetail();
        return $this->return_result($this->returnData);
    }
    
    //更新提现的状态
    public function toUpdateStatusTransfer()
    {
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(TransferService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toUpdateStatus();
        return $this->return_result($this->returnData);
    }

    // 导出数据
    public function toExportData(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(TransferService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->exportData();
        return $this->return_result($this->returnData);
    }

    //删除提现
    public function toDelTransfer()
    {
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(TransferService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toDel();
        return $this->return_result($this->returnData);
    }
}
